<!DOCTYPE html>
<html>
<head>
<title>GetSoftInfo Web</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">-->
<link rel="stylesheet" href="/css/bootstrap.min.css">
<script src="/js/jquery.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
</head>
<body class="background">
<?
	extract($_POST);
	extract($_GET);
	unset($_POST,$_GET);
	
	$sn=strtoupper(trim($sn)); // add remove left and right string space
	
	include "top.php";
	echo "<div class='container-fluid'>";
	echo "<div style='float:left'>";
	echo "	<form action='getconfig.php?act=q' method='POST' role='form' class='form-inline'>";
	echo "		<div class='form-group'>";
	echo "			<label for='inputSN' class='col-sm-4 form-control'>机器序号</label>";
	if(strlen($sn)<=0){
		echo "			<input type='text' class='form-control' name='sn' id='inputSN' placeholder='请输入机器序号'>";
	}else{
		echo "			<input type='text' class='form-control' name='sn' id='inputSN' value='$sn'>";
	}
	echo "			<button type='submit' class='btn btn-info form-control'>查询</button>";
	echo "		</div>";
	echo "	</form>";
	echo "</div>";
	echo "<br><br>";
	echo "<div>";
    
	if(strlen($sn)<=0)
		echo "<div>You need to input serial number</div>";
	else{
	
		$soapcli = new SoapClient("http://10.100.160.47:801/Service.asmx?wsdl");  
		$result = $soapcli->GetSoftInfo(array('sn'=>$sn, 'Tres'=>''));
		$arrRes = json_decode(json_encode($result),TRUE);
		
		if(!strstr($arrRes['GetSoftInfoResult'],"NOSN")){
			$i=1;
			echo "<table border=0  width=100% cellpadding=0 cellspacing=1><tr bgcolor='#2894FF'><th width=15%><font color='#ffffff'>关键字</font></th><th width=85%><font color='#ffffff'>值</font></th><tr>";
			$arr = explode(",",$arrRes['GetSoftInfoResult']);
			foreach($arr as $u){
				$strarr = explode(":",$u);
				if($i>0)
					echo "<tr><td>$strarr[0]</td><td>$strarr[1]</td><tr>\n";
				else
					echo "<tr bgcolor='#d0d0d0'><td>$strarr[0]</td><td>$strarr[1]</td><tr>\n";
				$i=-$i;
			}
			echo "</table>";
		}else{
			echo "serial number is error";
		}
	}
echo "</div>";
echo "</div>";
	include 'bottom.php';
?>
</body>
</html>